#include "basewindow.h"
///#include <QSize>
/// 基类窗口
BaseWindow::BaseWindow(QWidget *parent)
    : QMainWindow(parent)
{
    setMinimumSize(MIN_WIDTH, MIN_HEIGHT);
    //setupBaseStyle();
}
void BaseWindow::showEvent(QShowEvent *event)
{
    QMainWindow::showEvent(event);

    if (!m_initialized) {
        m_initialized = true;
        initStyle();  // ✅ 此时派生类已构造完毕，可安全虚派发
        initUI();
    }
}

void BaseWindow::changeEvent(QEvent *event)
{
    QMainWindow::changeEvent(event);

    if (event->type() == QEvent::WindowStateChange) {
        if (!(windowState() & Qt::WindowMinimized)) {
            QSize size = this->size();
            if (size.width() < MIN_WIDTH || size.height() < MIN_HEIGHT) {
                resize(MIN_WIDTH, MIN_HEIGHT);
            }
        }
    }
}
//初始化设置
void BaseWindow::setupBaseStyle()
{
    setMinimumSize(1200, 800);
    //setStyleSheet("background-color: #ffffff;");
}
void BaseWindow::initUI() {
    qDebug("basewindow initUI....");

}

void BaseWindow::initStyle(){
    qDebug("basewindow initStyle....");
    setupBaseStyle();
}
